package pc29.model;

public class SungJukVO {

	// 멤버 변수
	private String name;
	private int kor;
	private int eng;
	private int mat;
	private int tot;
	private double avg;
	private char grd;

	// 생성자
	public SungJukVO(String name, int kor, int eng, int mat) {
		this.name = name;
		this.kor = kor;
		this.eng = eng;
		this.mat = mat;
	}

	// 메서드

	// 멤버변수에 값을 저장하는 메서드 : setter
	// set멤버변수명(멤버변수자료형 멤버변수명)
	public void setName(String name) {
		this.name = name;
	}

	public void setKor(int kor) {
		this.kor = kor;
	}

	public void setEng(int eng) {
		this.eng = eng;
	}

	public void setMat(int mat) {
		this.mat = mat;
	}

	public void setTot(int kor, int eng, int mat) {
		tot = kor + eng + mat;
	}

	public void setAvg(int tot) {
		avg = tot / 3;
	}

	public void setGrd(double avg) {
		switch ((int) avg / 10) {
		case 10:
		case 9:
			grd = '수';
			break;
		case 8:
			grd = '우';
			break;
		case 7:
			grd = '미';
			break;
		case 6:
			grd = '양';
			break;
		default:
			grd = '가';
		}
	}

	// 멤버변수의 값을 읽어오는 메서드 : get
	// 멤버변수자료형 get멤버변수명(){return 변수명;}

	public String getName() {
		return name;
	}

	public int getTot() {
		return tot;
	}

	public double getAvg() {
		return avg;
	}

	public char getGrd() {
		return grd;
	}

	public String toString() {
		setTot(kor,eng,mat);
		setAvg(tot);
		setGrd(avg);
		String result = "";
		result += name + "/" + kor + "/" + eng + "/" + mat + "/" + getTot() + "/"
				+ getAvg() + "/" + getGrd();
		return result;
	}

}
